home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / shared.dir / 03021_Script_ACTIVATE-ENABLE-DISABLE BUTTONS < prev    next >
Text File  |  1996-06-21  |  3KB  |  71 lines

  1. -- --------------------------------------------------------
  2. -- Handler enableButton makes the given button enabled
  3. -- by changing its cast to its enabled cast.
  4.  
  5. on enableButton whichSprite
  6.   changeButtonCast (whichSprite, "ENABLED")
  7. end
  8.  
  9. -- --------------------------------------------------------
  10. -- Handler disableButton makes the given button disabled
  11. -- by changing its cast to its disabled cast.
  12.  
  13. on disableButton whichSprite
  14.   changeButtonCast (whichSprite, "DISABLED")
  15. end
  16.  
  17. -- --------------------------------------------------------
  18. -- Handler activateButton makes the given button activated
  19. -- by changing its cast to its activated cast.
  20.  
  21. on activateButton whichSprite
  22.   changeButtonCast (whichSprite, "ACTIVATED")
  23.   
  24.   updateStage
  25.   repeat while (not the mouseUp)
  26.     nothing -- to keep it hilited
  27.   end repeat
  28. end
  29.  
  30. -- --------------------------------------------------------
  31. -- Handler changeButtonCast changes the cast of the button
  32. -- in the given sprite according to the given mode.
  33.  
  34. on changeButtonCast whichSprite, mode
  35.   set buttonType = word 1 of the name of cast the castNum of sprite whichSprite
  36.   set newCastName = buttonType && mode
  37.   set the castNum of sprite whichSprite = the number of cast newCastName
  38. end
  39.  
  40. -- --------------------------------------------------------
  41. -- Handler isActivated checks if the button in the given sprite
  42. -- is active (determined if the last word of the name of the
  43. -- button's cast is "ACTIVATED").
  44.  
  45. on isActivated whichSprite
  46.   set buttonName = the name of cast the castNum of sprite whichSprite
  47.   set lastWord = the number of words in buttonName
  48.   return (word lastWord of buttonName = "ACTIVATED")
  49. end
  50.  
  51. -- --------------------------------------------------------
  52. -- Handler isEnabled checks if the button in the given sprite
  53. -- is enabled (determined if the last word of the name of the
  54. -- button's cast is "ENABLED").
  55.  
  56. on isEnabled whichSprite
  57.   set buttonName = the name of cast the castNum of sprite whichSprite
  58.   set lastWord = the number of words in buttonName
  59.   return (word lastWord of buttonName = "ENABLED")
  60. end
  61.  
  62. -- --------------------------------------------------------
  63. -- Handler isDisabled checks if the button in the given sprite
  64. -- is disabled (determined if the last word of the name of the
  65. -- button's cast is "DISABLED").
  66.  
  67. on isDisabled whichSprite
  68.   set buttonName = the name of cast the castNum of sprite whichSprite
  69.   set lastWord = the number of words in buttonName
  70.   return (word lastWord of buttonName = "DISABLED")
  71. end